{include file="../app/common/admin/lib/header.html"  title="自定义菜单"}
<div class="page-header border-bottom clearfix">
  <h2 class="left">菜单授权<span>在这里授权后，才能进行菜单管理操作</span></h2>
  {if $info.appid}
  <a href="{AnUrl('appmenu/admin')}" class="btn btn-default btn-sm right">&lt;&nbsp;返回菜单管理</a>
  {/if}
</div>
<div class="menubox">
  <dl class="alert">
      <dt>特别提示：</dt>
      <dd>
        <p>成功配置了授权信息，才能使用菜单接口　<a href="javascript:void(0);" class="js_guideBtn" style="color:#23a18b;">如何配置</a><i class="icon-doubt"></i></p>
        <p>必须服务号，申请自定义菜单资格后才能得到这2个值。</p>
      </dd>
  </dl>
  <div class="txtbox">
    <form id="js_appCreateForm" class="form-horizontal" action="{:url('/appmenu/bind_menu/save')}" method="post">
      <p class="txtone"><label><span class="txttit">AppId：</span><input type="text" name="appid" value="{$info.appid}" class="js_appid"></label></p>
      <p class="txtone"><label><span class="txttit">AppSecret：</span><input type="text" name="appsecret" value="{$info.appsecret}" class="js_appsecret"></label></p>
      <p class="btn-wrap5"><button type="submit" class="btn btn-success js_submit">确认</button></p>
    </form>
  </div>
  <div style="display: none;margin-top: 20px;margin-left: 60px;border: 1px solid #ccc;padding: 5px;" class="js_guideAppBox">
    <p class="ntc4">请先登录公众平台&nbsp;<a href="http://mp.weixin.qq.com/" target="_blank">http://mp.weixin.qq.com/</a>，拷贝Appid和AppSecret填入上方表单并提交。</p>
    <img width="650" src="{$Think.const.SITE_URL}/static/images/admin/appid_and_appsecret.jpg" >
  </div>
</div>
<script>
$(function(){
  $('.js_guideBtn').click(function(){
    var innerText = $(this).text();
    if (innerText == '如何配置') {
      $(this).text('收起帮助');
    } else {
      $(this).text('如何配置');
    }
    
    if (!$('.js_guideAppBox:visible').length) {
      $('.js_guideAppBox').css('display','inline-block');
    } else {
      $('.js_guideAppBox').hide();
    }
  });
  
  $('.js_submit').click(function(e){
    e.preventDefault();
    var appid = $.trim($('.js_appid').val());
    var appsecret = $.trim($('.js_appsecret').val());
    if (!appid) {
      showMsg('Appid不能为空');
      return;
    }
    if (!appsecret) {
      showMsg('Appsecret不能为空');
      return;
    }
    $('#js_appCreateForm').submit();
  });
});
</script>
{include file="../app/common/admin/lib/footer.html"}